{$CLEO .cs}
{$use cleo+}
0000:
 
model.Load(#PONY)
038B: load_requested_models

const
   busted = 14@ 

end   
:Retry
repeat 
wait 0 
until model.Available(#PONY)

    busted = false 
while $onmission >= 1   
wait 0  
   if $CAR_THEFTS_ACTIVE == false 
       then 
        if  00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2091.1577 -1564.1638 13.1583 radius 100.0 100.0 100.0
        then     
            if not  marker_enabled 2@ 
            then  
            2@ =  marker.CreateIconWithoutSphere(55 , 2091.1577, -1564.1638, 13.1583)
                 //show_styled_text "~w~The Car is discovered" 4000 5 
            end
            if not is_Car_defined 0@
            then
                
                 
                 0@ = car.Create(#PONY ,  2091.1577, -1564.1638, 13.1583)  
                 car.Angle(0@)= 182.2985
                 car.Health(0@ ) = 15000
                 09C4: set_car 0@ gas_tank_explosion_enabled 0
                 0423: set_car 0@ improved_handling_to 2.0 // (float)
                 0229: set_car 0@ primary_color_to 17 secondary_color_to 17
                 0E61: set_car_alarm 0@ mode 1

                 wait 100   
            end 
        else
            
            if is_Car_defined  0@
            then
                car.RemoveReferences( 0@ )
            end 
            
             
            wait 100
        end 
            if is_Car_defined  0@
            then
                if coop
                then
                   if or
                    actor.InCar( player1, 0@)
                    actor.InCar( player2, 0@)
                   then
                      Jump @Start 
                   end            
                else
                  if  actor.InCar( player1, 0@)
                  then
                     Jump @Start 
                  end              
                end 
    
            end   
    end    
end 
//Cleanup 
:start
$MISSION_MUSIC_IS_ACTIVE = 2 
$CAR_THEFTS_ACTIVE = true 
        if   marker_enabled 2@ 
        then   
            marker.Disable( 2@ )
        end
0167: 1@ = create_marker_at 982.3314 -1435.9677 13.5469 color 4 flag 2
marker.SetIconSize(1@ , 3 )
show_styled_text "~w~Now Deliever the car, don't let the cops see you in this car"  4000 5 
while $onmission >= 1   
wait 0 

    if  
     $WAVE >= 1 
    then
        if $WAVE < 3
        then
           $WAVE = 3 
        end
         busted = true 
        {
        if busted == false 
        then
            show_text_box "~r~YOU BLEW IT! ~w~Now the cops see you jacking the car, it's can't be delivered without notoriety, lose them first!"

            busted = true 
        end  }
    else
        busted = false 
    end 
    if is_Car_defined  0@
    then
        if  or 
        8205:   not actor $PLAYER_ACTOR near_car 0@ radius 120.0 120.0 120.0 flag 0
        car.Wrecked(0@ )
        then
        show_styled_text "~r~You lost the car!" 4000 5
        018C: play_sound 1053  at 0.0 0.0 0.0

        car.RemoveReferences( 0@)
        if marker_enabled 1@
        then
           marker.Disable( 1@  )
        end     
            $DOING_DRUGS = false  
            $CAR_THEFTS_ACTIVE = false 
            $MISSION_MUSIC_IS_ACTIVE = 0 
            jump @Retry 
        end 
            if coop
            then
               if or
                actor.InCar( player1, 0@)
                actor.InCar( player2, 0@)
               then 
                    $DOING_DRUGS = true 
               else 
                    $DOING_DRUGS = false  
               end            
            else
               if  actor.InCar( player1, 0@)
              
               then
                   $DOING_DRUGS = true 
               else 
                    $DOING_DRUGS = false  
               end          
            end     
  
        //to location
        if  
        01B0:   car 0@ sphere 1 in_sphere 982.3314 -1435.9677 13.5469  radius 5.0 5.0 5.0 stopped
        then
            018C: play_sound 1052  at 0.0 0.0 0.0
            show_styled_text "~y~Car delivered! ~w~$10000" 4000 5
            0109: player $PLAYER_CHAR money += 10000

            car.LockInCurrentPosition(0@   ) = true
            car.DoorStatus(0@, 2)
            car.SetImmunities(0@,1,1,1,1,1)
            car.RemoveReferences(0@)
            $CAR_THEFTS_DELIVERED += 1 
            break 
        end 
       
    end 
end 
if is_Car_defined  0@
then
    car.RemoveReferences( 0@ )
end 
if marker_enabled 1@
then
   marker.Disable( 1@  )
end          
if marker_enabled 2@
then
   marker.Disable( 2@  )
end          
$CAR_THEFTS_ACTIVE = false  
$DOING_DRUGS = false  
$MISSION_MUSIC_IS_ACTIVE = 0 
model.destroy(#PONY)
terminate_this_custom_script